// components/nav-bar/index.js
const app=getApp()
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    title: {
      type: String,
      value: ''
    },
    navbg: {
      type: Boolean,
      value: false,
      observer: function (newVal, oldVal) {}
    },

  },

  /**
   * 组件的初始数据
   */
  data: {
    title:'',
    navbg:false,
    height: app.globalData.navHeight,
    topHeight: app.globalData.height,
    navContentHeight:app.globalData.navContentHeight,
    navContentWidth:app.globalData.navContentWidth,
  },

  /**
   * 组件的方法列表
   */
  methods: {
      // 返回上一页面
      _navback() {
        let pages = getCurrentPages();
        let prePage = pages[pages.length-2];
        console.log(prePage)
        if (prePage && prePage.__route__){
          wx.navigateBack()
        } else {
          wx.switchTab({
            url: '/pages/index/index',
          })
        }
      },
  },
  
})